package com.example.demo1.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

/**
 * @Title: Common.java
 * @author wuzhq
 * @date 2018-01-02 18:31:44
 * @version V1.0
 */ 
public class Common {
	static SnowflakeIdWorker idWorker = null;
	static {
		idWorker  = new SnowflakeIdWorker(0, 0);
	}
	
	public static String uuid(){
		return UUID.randomUUID().toString().replace("-", "");
	}
	
	public static Long workerId(){
		return idWorker.nextId();
	}
	
	public synchronized static String  getSerialId()
	{
		return new SimpleDateFormat("yyMMddHHmmssSSS").format(new Date()) + String.format("%05d", new Random().nextInt(99999));
	}
	// 获取案件编号
	public synchronized static String  getAJSEQ()
	{
		return "JFAJ-"+new SimpleDateFormat("yyMMddHHmmssSSS").format(new Date()) + String.format("%02d", new Random().nextInt(999));
	}

	public static String currentYear(){
		return Calendar.getInstance().get(Calendar.YEAR)+"";
	}

	public static String getOrderIdByUUId(){
		int machineId=1;
		int hashCodeV=UUID.randomUUID().toString().hashCode();
		if(hashCodeV< 0){ 
			hashCodeV=-hashCodeV;
		}
		return machineId+String.format("%015d",hashCodeV);
	}
	
	public static void main(String[] args) {
		int a= 10;
		int b= 0;
		if(a>50){
			b= 9;
		}
		System.out.println(b);
	}
}

